<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>AddJSONElement</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">AddJSONElement()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>AddJSONElement</b></font>(JSONValue [, Index])</blockquote>

<b>概要</b><br><blockquote>



Add a new array element to a JSON value of <a href="jsontype.html">type</a> <font color="#924B72">#PB_JSON_Array</font>. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>JSONValue</i></td>
<td width="90%"> 
 
The JSON value. The value must be of type <font color="#924B72">#PB_JSON_Array</font>. 

 

</td></tr>
<tr><td><i>Index (optional)</i></td>
<td> 
 
The index at which the new value will be inserted into the array. If the index is outside 
of the range of the array, the new value will be inserted either at the start (for Index &lt; 0) or the end 
of the array. If this parameter is not specified, the new value is added at the end of the array. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns the address of the added JSON value. 
The newly added value initially has type <font color="#924B72">#PB_JSON_Null</font>. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateJSON</font>(0)
    ArrayValue =<font color="#3A3966"> SetJSONArray</font>(<font color="#3A3966">JSONValue</font>(0))
    
    <font color="#3A3966">; add element at the end</font>
    <b><font color="#3A3966">For</font></b> i = 1 <b><font color="#3A3966">To</font></b> 5
      NumValue =<font color="#3A3966"> AddJSONElement</font>(ArrayValue)
<font color="#3A3966">      SetJSONInteger</font>(NumValue, i)
    <b><font color="#3A3966">Next</font></b> i
    
    <font color="#3A3966">; insert at a specific index</font>
    StrValue =<font color="#3A3966"> AddJSONElement</font>(ArrayValue, 1)
<font color="#3A3966">    SetJSONString</font>(StrValue, "Hello")
    
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">ComposeJSON</font>(0)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="setjsonarray.html">SetJSONArray()</a>, <a href="removejsonelement.html">RemoveJSONElement()</a>, <a href="resizejsonelements.html">ResizeJSONElements()</a>, 
<a href="clearjsonelements.html">ClearJSONElements()</a>, <a href="getjsonelement.html">GetJSONElement()</a>, <a href="jsonarraysize.html">JSONArraySize()</a>, <a href="jsontype.html">JSONType()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center><a href="index.html">Json Index</a> - <a href="addjsonmember.html">AddJSONMember()</a> -&gt;<br><br>

</body></html>